package com.bom.boot.easy.controller;

import com.bom.boot.easy.controller.exception.InException;
import com.bom.boot.easy.core.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionControllerHandler {

    @ExceptionHandler(value = InException.class)
    @ResponseBody
    public Result<Object> exceptionHandler(InException e) {
        return Result.fail(e.getMessage()).build();
    }

}
